<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
	<title>铁水联运信息核查系统--注册</title>
    <link rel="shortcut icon" href="${mainDomain}/statics/images/favicon.ico">
    <link rel="stylesheet" href="${mainDomain}/statics/css/front/amazeui.min.css"/>
    <link rel="stylesheet" href="${mainDomain}/statics/css/front/goodsstyle.css">
    <link rel="stylesheet" href="${mainDomain}/statics/css/front/custom.css">
    <script type="text/javascript">
        var mainDomain = "${mainDomain}";
		var miscDomain = '${mainDomain}';
    </script>
    <style>
    .header {
      text-align: center;
    }
    .header h1 {
      font-size: 200%;
      color: #333;
      margin-top: 30px;
    }
    .header p {
      font-size: 14px;
    }
    .item {
    	margin: 30px 0; 
    }
    .form {
    	text-align: center;
    }
    </style>
</head>
<body style="background:url(${mainDomain}/statics/images/ts-bg.jpg) no-repeat center top">
<!-- 头部导航 begin -->
<div id="logo"></div>
<!-- 头部导航 end -->
<div class="header" style="min-width:1349px;">
  <div class="am-g">
    
  </div>
  <div class="header">
  <div class="am-g" style="min-width: 1000px;">
    <div class="am-u-sm-5 logo" style="padding:0px;">    		
      		<!--<a href="/index"><img src="${mainDomain}/statics/images/x_logo.png"/></a>-->
      	</div>	
  </div>

</div>

<div  class="am-container"style="">
  <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered" style="width:720px;margin:auto;">
   <h1 style="text-align: center; color:#00688B; font-family: '微软简中国'; font-size:24px; margin-top: 10px;">欢迎注册</h1>
   <div style="margin:10px 0;">
     <img src="${mainDomain}/statics/images/goods/rg1.png">
   </div>
      <form id="my-form" action="javascript:;" method="post" class="am-form" data-am-validator>
			<div class="form">	
			  <table style="margin:auto;border-collapse:separate;border-spacing:15px;">
			     <tr>
			         <td><label style="color:#00688B;" for="">用户名:</label></td>
			         <td><input name="yhid" type="text" id="yhid" placeholder="请输入用户名" class="text am-input-sm" maxlength=20  required style="width:200px;border-radius:10px;height:35px;"/></td>
			         <td style="width:150px;text-align:left;"><div id="yhid_tips" style="color:red;font-size:14px;">＊ </div></td>
			     </tr>
			     <tr>
			         <td><label style="color:#00688B;" for="">密&nbsp;&nbsp;&nbsp;&nbsp;码:</label></td>
			         <td><input name="password" type="password" id="password" placeholder="请输入密码" class="text am-input-sm" required style="width:200px;border-radius:10px;height:35px;"/></td>
			         <td style="width:150px;text-align:left;"><div id="password_tips" style="color:red;font-size:14px;">＊ </div></td>
			     </tr>
			     <tr>
			         <td><label style="color:#00688B;" for="">确认密码:</label></td>
			         <td><input type="password" data-equal-to="#password" id="mm" name="mm" class="text am-input-sm" placeholder="请输入确认密码" required style="width:200px;border-radius:10px;height:35px;"/></td>
			         <td style="width:150px;text-align:left;"><div  id="mm_tips" style="color:red;font-size:14px;">＊ </div></td>
			     </tr>
			     <!-- <tr>
			         <td><label style="color:#00688B;" for="">手机号码:</label></td>
			         <td><input name="sjh" type="number" id="sjh" maxlength=11  placeholder="请输入手机号码" class="text am-input-sm" required style="width:200px;border-radius:10px;height:35px;"/></td>
			         <td style="width:150px;text-align:left;"><div  id="sjh_tips" style="color:red;font-size:14px;">＊ </div></td>
			     </tr>
			     <tr>
			         <td><label style="color:#00688B;" for="">邮箱:</label></td>
			         <td><input name="email" type="email" id="email" maxlength=20 placeholder="请输入邮箱" class="text am-input-sm" required style="width:200px;border-radius:10px;height:35px;" /></td>
			         <td style="width:150px;text-align:left;"><div id="email_tips" style="color:red;font-size:14px;">＊ </div></td>
			     </tr>
			    <tr>
			         <td><label for="">验证码:</label></td>
			         <td><input id="mobile_code" class="text text_te" type="text" placeholder="手机验证码" name="mobile_code"></td>
			         <td><input id="zphone" class="am-btn" type="button" value="获取验证码 "></td>
			     </tr>
			     <tr >
			         <td colspan="3" style="text-align:left;"><input name="agreement" type="checkbox" value="1" checked="checked" class="checkbox" required/>
						<span class="mar-b" style="font-size: 14px;">我接受《<a href="" style="color:#555;text-decoration: underline;" target="_blank">纠纷仲裁处理条款</a>》</span></td>
			         
			     </tr>-->
			     <!--<tr>
			         <td colspan="3" style="text-align:left;"><input name="agreement" type="checkbox" value="1" checked="checked" class="checkbox" required/>
						<span class="mar-b" style="font-size: 14px;">我已看过并接受《<a href="" style="color:#555;text-decoration: underline;" target="_blank">用户协议</a>》</span></td>
			         
			     </tr>-->
			     <tr >
			         <td colspan="3" style="text-align:center;"><button type="sumbit" id="saveButton" class="am-btn am-btn-primary am-btn-xs" style="width:200px;height30px;font-size:16px;">确认提交&nbsp;|&nbsp;下一步</button></td>
			         
			     </tr>
			  </table>
						
			</div>
		</form>
	<hr/>		
    </div>    
</div>
	
    <br>
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }" style="min-width: 1349px;">
        <!--<div class="am-footer-switch" style="font-weight:normal;">
            <span class="am-footer-ysp" data-rel="mobile"
                  data-am-modal="{target: '#am-switch-mode'}">
                  武汉航运交易所
            </span>
              <span class="am-footer-divider"> | </span>
              <a id="godesktop" data-rel="desktop" class="am-footer-desktop" href="javascript:">
                  法律申明
              </a>
              <span class="am-footer-divider"> | </span>
              <span class=""> 鄂ICP备16003518 </span>
        </div>
        <div class="am-footer-miscs ">
            <p>版权所有：武汉航运交易所</p>
            <p>地址：武汉市江岸区金桥大道117号市民之家3楼F区</p>
            <p>电话：027-65771553</p>
        </div>-->
  </footer>
    <script type="text/javascript" src="${mainDomain}/statics/js/front/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/amazeui.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/formvalidation.js"></script>
    <script>
    function chkUsername() {
		 var username = $.trim($("#yhid").val());
		 if(username=="") {
		  return 0;
		 }
		 else if( /^\d.*$/.test( username ) ){
		  //用户名不能以数字开头
		  return -1;
		 }
		 else if(username.length<6 || username.length>20 ){
		  //合法长度为6-20个字符
		  return -2;
		 }
		  else if(! /^\w+$/.test( username ) ){
		  //用户名只能包含_,英文字母，数字
		   return -3;
		 }
		 else if(! /^([a-z]|[A-Z])[0-9a-zA-Z_]+$/.test( username ) ){
		  //用户名只能英文字母开头
		  return -4;
		 }
		 else if(!(/[0-9a-zA-Z]+$/.test( username ))){
		  //用户名只能英文字母或数字结尾
		  return -5;
		 }
		  return 1;
		} 
    
	$('#my-form').validator({
	
		validate: function (validity) {
			
			if ($(validity.field).is('#yhid')) {
                        var ret = chkUsername();
                        if(ret == 0){
					     //显示具体的错误内容
					     validity.valid = false;
					     $('#yhid_tips').html("用户名必填");
					    }
                        else if(ret == -1){
					     //显示具体的错误内容
					     validity.valid = false;
					     $('#yhid_tips').html("不能以数字开头");
					    }
					    else if(ret == -2){
					    validity.valid = false;
					     $('#yhid_tips').html("长度为6-20个字符");
					    }
					    else if(ret == -3){
					    validity.valid = false;
					     $('#yhid_tips').html("用户名只能包含_,英文字母,数字 ");
					    }
					    else if(ret == -4){
					    validity.valid = false;
					    $('#yhid_tips').html("只能英文字母开头");
					    }
					    else if(ret == -5){
					    validity.valid = false;
					     $('#yhid_tips').html("只能英文字母或数字结尾");
					    }
					    else
					    {
					    	validity.valid = true;
                            $('#yhid_tips').html("");
					    }
                    }
                    
                    
                    
                    if ($(validity.field).is('#password')) {
                    	if($.trim($("#password").val()).length>20)
                    	{
                    		validity.valid = false;
                    		$('#password_tips').html("密码只能小于20位");
                    	}
                    	else if($.trim($("#password").val()).length<5)
                    	{
                    		validity.valid = false;
                    		$('#password_tips').html("密码不能能小于5位");
                    	}
                    	else
					    {
					    	validity.valid = true;
                            $('#password_tips').html("");
					    }
                    }
                    
                    if ($(validity.field).is('#mm')) {
                    	if($.trim($("#mm").val())!=$.trim($("#password").val()))
                    	{
                    		validity.valid = false;
                    		$('#mm_tips').html("两次密码输入不一致");
                    	}
                    	else if($.trim($("#mm").val()).length>20)
                    	{
                    		$('#mm_tips').html("密码只能小于20位");
                    	}
                    	else
					    {
					    	validity.valid = true;
                            $('#mm_tips').html("");
					    }
                    }
                    
                   
		},
        
        submit: function() {
        	if(this.isFormValid()){
        	
        	
        	$.ajax( {  
	        type : 'POST',  
	        url : '/login/registerconfig',  
	        data : $('#my-form').serialize(),  
	        success : function(data) {  
	        	var msg = data.message;
	        	if(msg==1)
        		{
	        		alert('提交成功');
	        		
	        		var userid = $("#yhid").val();
	        		window.location.href="/login/registertwo?userid="+userid;
        		}
	        	else
        		{
        			
		        	alert(msg);
        		} 
	        },  
	        error : function(data) {  
	          alert("注册失败")  
	        }  
	      });
        }
        }
        
       
    })
	</script>
</body>
</html>